package aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import pojo.Book;

@Component
@Aspect
public class CharAspect {
	private final String pointCut="execution(* service.*.addBook(pojo.Book))";
	@Around(value=pointCut)
	public Object toUpper(ProceedingJoinPoint point){
		Object o=null;
		Book b=(Book)point.getArgs()[0];
		b.setBookName(b.getBookName().toUpperCase());
		try {
			o=point.proceed();
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return o;
	}
}
